package com.onLineCar.es.controller;

import com.godGuang.common.core.domain.PageResult;
import com.godGuang.common.core.domain.Result;


import com.onLineCar.es.domain.Content;
import com.onLineCar.es.domain.request.RequestContent;
import com.onLineCar.es.service.EsService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * ES控制器Controller
 */

@RestController
@RequestMapping("/es")
@Log4j2
public class EsController {

    @Autowired
    private EsService esService;


    /**
     * 获取内容列表
     *
     * @param requestContent 请求体
     * @return 包含分页结果的响应
     */
    @PostMapping("/list")
    public Result<PageResult<Content>> list(@RequestBody RequestContent requestContent){
        log.info("list入参:{}",requestContent);
        PageResult<Content> pageResult = esService.list(requestContent);
        log.info("list出参:{}",pageResult);
        return Result.success(pageResult);
    }
}
